﻿@model IEnumerable<EventScore>
@{
    Layout = "~/Views/Shared/_Dashboard.cshtml";
    var groups = Model.GroupBy(e => e.Location);
}
@UIHelper.ImageTitle(Html.Global("RES_SCORES"), "", Url.Content("~/content/images/icon_points_48.png"))
@using (Html.BeginForm())
{
    @(
 Ajax.Dna().Grid(groups)
 .ExpandDetailView()
.Columns(cols =>
{
    cols.Bound(m => m.Key).Title(Html.Global("RES_Location"));
})
.DetailView(@<text>
    @_GridEditor(item)
    </text>)
.GetHtml()
)
    <br />
<hr />
    <div style="text-align:center;">
    @Ajax.Dna().Button("btnSubmit").Submit().LocText("RES_SAVE").ImageIcons(Url.Content("~/content/images/icon_save.gif")).GetHtml()
    </div>
}
@helper _GridEditor(IEnumerable<EventScore> data)
    {
    @(Ajax.Dna().Grid(data)
        .Columns(c =>
        {
            c.Bound(i => i.Title).Width(200).Title(Html.Global("RES_TITLE"));
            c.Bound(i => i.Description).Title(Html.Global("RES_DESC"));
            c.Bound(i => i.Points).Title(Html.Global("RES_POINTS")).Template(@<text>
    @Ajax.Dna().TextBox(item.Name).NumericOnly().Value(item.Points).GetHtml()
    </text>).Width(200);
        })
        .GetHtml())
}